home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / ARRAYOB.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  2KB  |  49 lines

  1. #ifndef ARRAYOB_H
  2. #define ARRAYOB_H
  3.  
  4. #include "collect.h"
  5. #include <alloc.h>
  6.  
  7. extern const Class class_ArrayOb;
  8.  
  9. ////////////////////////////////////////////////////////////
  10. // class ArrayOb (declaration)
  11. ////////////////////////////////////////////////////////////
  12. class ArrayOb: public Collection {
  13.     Object**    v;
  14.     unsigned    sz;
  15.  
  16.     void        allocSizeErr() const;
  17.     void        indexRangeErr() const;
  18. public:
  19.                 // constructors, destructors
  20.                 ArrayOb(unsigned size =CLTN_DEFAULT_CAPACITY);
  21.                 ArrayOb(const ArrayOb&);
  22.                 ~ArrayOb();
  23.  
  24.                 // operators
  25.     bool        operator!=(const ArrayOb& a) const   { return !(*this==a); }
  26.     void        operator=(const ArrayOb&);
  27.     bool        operator==(const ArrayOb&) const;
  28.     Object*&    operator[](int i) const {
  29.                     if ((unsigned)i >= sz) indexRangeErr();
  30.                     return v[i]; 
  31.                 }
  32.     Object*&                elem(int i) const    { return v[i]; }
  33.     virtual Collection&     addContentsTo(Collection&) const;
  34.     virtual Object*&        at(int i) const;
  35.     virtual unsigned        capacity() const;
  36.     virtual void            deepenShallowCopy();
  37.     virtual Object*         doNext(Iterator&) const;
  38.     virtual unsigned        hash() const;
  39.     virtual const Class*    isA() const;
  40.     virtual bool            isEqual(const Object&) const;
  41.     virtual void            printOn(ostream& strm) const;
  42.     virtual void            reSize(unsigned);
  43.     virtual unsigned        size() const;
  44.     virtual void            sort() const;
  45.     virtual const Class*    species() const;
  46. };
  47.  
  48. #endif
  49.